import { observable, action } from 'mobx';
import Apis from '../apis/roomPlan';
import {WeaTableNew, WeaForm} from 'comsMobx';
const {TableStore} = WeaTableNew;
import {WeaLocaleProvider} from 'ecCom';
const getLabel = WeaLocaleProvider.getLabel;
export default class RoomPlan {
	title = `${getLabel(15881,'会议室使用情况')}`;
	@observable userList = [];
	// @observable comsWeaTableStore = new TableStore();
	
	@observable form = new WeaForm;
	@observable comsWeaTableStore = {};
	@observable roomPlanStatus = {
		loading: false,
		org: {},//左侧选择的区域
	}
	
	@observable searchFields =  [];
	@observable advanceSearchParams = {};

	@observable dragChooseVisible = true;

	@action
	addUser(params) {
		this.userList.push({ name: "dyf" });
	}

	setState = (params, callback) => {
		Object.keys(params).forEach(key => {
			this[key] = params[key];
		});
		typeof callback === 'function' &&  callback();
	}

	getUserList(params) {
		return this.userList.slice();
	}
	
	doLoading = (loading) => {
		this.roomPlanStatus = { ...this.roomPlanStatus, loading: loading }
	}
	
	setOrg = (org) => {
		this.roomPlanStatus = { ...this.roomPlanStatus, org: org }
	}
	
	getRoomReportList = (params, callback)=>{
    Apis.getRoomReportList(params).then(data =>{
			this.comsWeaTableStore = {...this.comsWeaTableStore, [data.sessionkey]:new TableStore()};
      this.comsWeaTableStore[data.sessionkey].getDatas(data.sessionkey, 1);
      if(callback)callback(data.sessionkey);
    })
  }
  
  /*getRoomReportBaseData = () => {
		Apis.getRoomReportBaseData().then(result => {
      this.form.initFormFields(result.searchFields);
			this.searchFields = result.searchFields;
		})
	}*/
  
  getFormParams = () => {
    return this.form.getFormParams();
  }
	@action 
	resetFormParams=()=>{
		this.form.resetForm()
	}
}



